import axios from "../util/axios";
import { APIKEY } from "../util/constant";

export const createConversation = (data) => {
  return axios.post('/create_conversation', data);
};

export const chatQuery = (data) => {
  // return axios.post('/chat_query_v2', data);
  return fetch('/api/proxy/api/v1/chat_query_v2', {
    method: 'POST',
    headers: {
      'accept': 'application/json, text/event-stream',
      'Content-Type': 'application/json',
      'Apikey': APIKEY  // 告诉服务器发送的是 JSON
    },
    body: JSON.stringify(data)
  });
};